package gps.monitor.jt809server.network.netty;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @author cyq
 * @date 2021/11/6
 * @desc talk is cheep,show me the code
 */
public class SimpleJt809NettyEncoder extends MessageToByteEncoder {

    protected void encode(ChannelHandlerContext channelHandlerContext, Object o, ByteBuf byteBuf) throws Exception {
        //byteBuf.writeByte(Jt809Keywords.K5B);
        //byteBuf.writeCharSequence((String) o, Charset.forName("UTF-8"));
        //byteBuf.writeByte(Jt809Keywords.K5D);
        byteBuf.writeBytes(ByteBufUtil.decodeHexDump((String) o));
    }
}
